<?php 
defined('SYS_IN') OR die('error');
abstract class db extends base{

	/**
	 *lastSql is success 
	 */
	public $isSuccess = false;
	/**
	 * 连接
	 **/
	abstract public function connect();
	/**
	 * 执行sql
	 * @param string $sql
	 * @param array  $array param
	 **/
	abstract public function query($sql,$array=array());
	/**
	 * table
	 * @param string $table tablename
	 */
	abstract public function table($table);
	/**
	 * where
	 * @param string $where
	 * @param array	 $param
	 **/
	abstract public function where($where,$param=array());
	
	/**
	 * setColumn
	 * @param string $str
	 */
	abstract public function setColumn($str);
	
	/**
	 *getOne
	 *@return array
	 **/
	abstract public function getOne();

	/**
	 *getAll
	 *@return array
	 **/
	abstract public function getAll();

	/**
	 *limit
	 *@param int $start
	 *@param int $size
	 **/
	abstract public function limit($start,$size=null);

	/**
	 * insert
	 * @param array $arr1
	 * @param array $arr2
	 * @example 
	 * 	one:insert(array('id'=>1,'name'=>'test'));
	 * <p>
	 *	more:insert(array('id','name'),array(array(1,'test'),array(2,'test2'));
	 * </p>
	 * @return int id
	 **/
	abstract public function insert($arr1,$arr2=array());

	/**
	 *del
	 *@return int row
	 **/
	abstract public function del();

	/**
	 *update
	 *@return int row
	 **/
	abstract public function update($array);

	/**
	 *getLastId
	 *@return int id
	 **/
	abstract public function getLastId();
	
	/**
	 * getLastSql
	 * @return string sql
	 */
	abstract public function getLastSql();
	
	/**
	 * getError
	 * @return array info
	 */
	abstract public function getError();
	
	/**
	 * leftJoin table
	 * @param string $table
	 * @param string $where
	 */
	abstract public function leftJoin($table,$where);
	
	/**
	 * order
	 * @param string $str
	 */
	abstract public function order($str);
	
	/**
	 * groupby
	 * @param string $str
	 */
	abstract public function groupBy($str);
	
	/**
	 * having
	 * @param string $where
	 * @param array	 $param
	 **/
	abstract public function having($where,$param=array());
	
	/**
	 * getCount
	 * @return int row
	 */
	abstract public function getCount();
	
	/**
	 * begin 开始事务
	 * transaction
	 * @return bool
	 */
	abstract public function begin();
	
	/**
	 * rollback 回滚
	 * @return bool
	 */
	abstract public function rollBack();
	
	/**
	 * commit 提交事务
	 * @return bool
	 */
	abstract public function commit();
}
?>
